<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link rel="stylesheet" href="assets/css/login.css">
    <script src="assets/js/jquery-1.7.2.min.js"></script>
</head>
<body class="login_body" style="min-width: 1200px">
<img src="assets/images/BG.png" alt="" class="big">
<div class="login_con">
    <img src="assets/images/logo.png" alt="" class="logo">
    <div class="login_left">
        <img src="assets/images/loginbanner.png" alt="">
    </div>
    <div class="login_right">
        <p class="login_r_tit">用户登录</p>
        <ul class="login_r_ul">
            <li>
                <img src="assets/images/user.png" alt="">
                <input type="text" id="username" placeholder="用户名称">
            </li>
            <li>
                <img src="assets/images/pass.png" alt="">
                <input type="password" id="password" placeholder="用户密码">
            </li>
            <li>
                <img src="assets/images/login_num.png" alt="">
                <input type="text" id="level_id" placeholder="企业编号">
            </li>
            <li class="login_border">
                <div>
                    <img src="assets/images/login_check.png" alt="">
                    <input type="text" id="verifyCode" name="verifyCode" placeholder="验证码">
                </div>
                <img src="http://www.chinalightning.com.cn/api/auth_code_port/" id="code" alt="">
            </li>
        </ul>
        <div class="forget">
            <p>记住密码</p>
            <a href="">忘记密码?</a>
        </div>
        <a href="#" onclick="login()" class="login_btn">登 录</a>


    </div>
</div>
<div class="fix">南京欧文达电气科技有限公司<a href="">南京欧文达电气科技有限公司</a>
</div>
<script>
    $("#code").on("click",function () {
       $(this).attr("src","http://www.chinalightning.com.cn/api/auth_code_port/?t="+Math.random())
    });

    function login(){
 var username=$("#username").val();
 var password=$("#password").val();
 var verifyCode=$("#verifyCode").val();

 var level_id=$("#level_id").val();
 if (username.trim()==""){
     alert("用户名为空！")
     $("#username").focus()
     return;

 }
        if (level_id.trim()==""){
            alert("企业编号为空！")
            $("#level_id").focus()
            return;

        }
        if (password.trim()==""){
            alert("密码为空！")
            $("#password").focus()
            return;

        }

        if (verifyCode.trim()==""){
            alert("验证码为空！")
            $("#verifyCode").focus();
            return;
        }



 var data={username,password,level_id,verifyCode}
 $.post("http://www.chinalightning.com.cn/api/login/",data, function (res) {
  if (res.message==200){
      var url="system/style16_accordion_blue/main.html?datas="+res.username+","+res.head+","+res.Administrator;

      window.location.href=url;

  }else {
      alert(res.message);
      $("#code").click()
  }
 })
    }



    $(".big").css({width: $(window).width(), height: $(window).height()});
    $(".forget p").click(function () {
        if($(this).hasClass("login_seled")){
            $(this).removeClass("login_seled");
        }else {
            $(this).addClass("login_seled");
        }
    })
</script>
</body>
</html>
